import { defHttp } from '/@/utils/http';

export function getDeptsApi(params: any) {
  return defHttp.get<any>({ url: '/api/dept', params }, { joinParamsToUrl: true });
}

export function getDeptSuperiorApi(ids: number[]) {
  const data = ids.length || ids.length === 0 ? ids : Array.of(ids);
  return defHttp.post<any>({ url: '/api/dept/superior', data });
}

export function addDeptApi(params: any) {
  return defHttp.post<any>({ url: '/api/dept', params });
}

export function editDeptApi(params: any) {
  return defHttp.put<any>({ url: '/api/dept', params });
}

export function delDeptApi(ids: number[]) {
  return defHttp.delete<any>({ url: '/api/dept', params: ids });
}
